package com.cq.jackmar.rxdemo.demo;

import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.widget.TextView;

import com.cq.jackmar.rxdemo.R;
import com.cq.jackmar.rxdemo.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by JackMar on 2017/3/9.
 * 邮箱：1261404794@qq.com
 */

public class RefreshActivity extends BaseActivity {
    @Bind(R.id.tv_content)
    TextView mTvContent;
    @Bind(R.id.srl_layout)
    SwipeRefreshLayout mSrlLayout;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_refresh;
    }

    @Override
    protected void initView() {
        mSrlLayout.setColorSchemeResources(android.R.color.holo_green_dark, android.R.color.holo_blue_dark, android.R.color.holo_orange_dark);
        mSrlLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mSrlLayout.setRefreshing(false);
                    }
                },1000);
            }
        });
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
